/**
 * 
 */
package com.gamutsoft.amb.common.util;

import org.apache.log4j.Logger;

import com.gamutsoft.amb.user.model.SystemUser;

/**
 * @author Administrator
 *
 */
public class SessionUserUtil {

	private static final Logger log = Logger.getLogger(SessionUserUtil.class);
	
	/**
	 * 从当前Session中获得已登陆用户信息
	 * 
	 * @return
	 */
	public static SystemUser getLoginUser() {
		SystemUser loginUser = null;
		try {
//			Authentication auth = SecurityContextHolder.getContext().getAuthentication();
//			loginUser = (loginUser) auth.getPrincipal();
			
		} catch (Exception e) {
			log.error(e.getMessage(), e);
		}
		return loginUser;
	}
	/**
	 * 从当前Session中获得已登陆用户名
	 * 
	 * @return
	 */
	public static String getLoginName() {
		
		String loginName = null;
		SystemUser loginUser = getLoginUser();
		if(loginUser != null) {
			loginName = loginUser.getUsername();
		}
		return loginName;
	}
}
